GetIdleTime() DLL Call and Sample Program. (c) 1994, Malik Information Services, All Rights Reserved For more information on the products and services of MIS, Contact Malik Information Services Attn: Nick Malik 21134 N.E. 5th Place Miami, Florida 33179 Included: TESTDLL.EXE - a VB program that uses the HOWLONG.DLL routines to display the time since last event, and the clock tick on which the event occured. TESTDLL.FRM - The VB program source for TESTDLL.EXE TESTDLL.FRX TESTDLL.MAK HOWLONG.DLL - A DLL containing routines that track the last time that the user moved the mouse or pressed a key. License Statement: This VB program, and the DLL that it calls, are property of Malik Information Services. A license is granted to any and all users who would like to include any portion of either the VB program or the DLL into their code, under the condition that any such user agrees that Nicklas Malik, Malik Information Services, and any of its employees, affiliates, distributors, or directors, are not liable for any damages, special, incidental, consequential or otherwise, arising out of the use of these programs. Installation: Copy HOWLONG.DLL into your /WINDOWS/SYSTEM directory. The following routines are defined in the DLL: GetIdleTime - returns the tick count at the last mouse or keyboard event. ResetIdleOnUser - Sets or clears a flag allowing WM_USER messages to be considered to be a keyboard event for the purposes of GetIdleTime. Full Descriptions: GetIdleTime C: DWORD FAR PASCAL GetIdleTime(void); VB: Declare Function GetIdleTime Lib "HOWLONG.DLL" () As Long Parameters: None Function: When any of the following Windows Messages is sent, to any task, a Windows Hook routine defined in HOWLONG.DLL will record the return value of the Windows API call 'GetTickCount'. WM_KEYDOWN WM_LBUTTONDOWN WM_MBUTTONDOWN WM_RBUTTONDOWN WM_NCLBUTTONDOWN WM_NCMBUTTONDOWN WM_NCRBUTTONDOWN WM_MOUSEMOVE WM_NCMOUSEMOVE WM_USER + any non-negative value The WM_USER messages are included because the MS-DOS prompt Window does not use the ButtonDown messages, or, in fact, any Keypress messages at all. When MS-DOS is displayed in a window, and the user is typing, without using the mouse, Windows will appear idle unless WM_USER messages are seen. To tell the Hook routine to ignore User messages, see the ResetIdleOnUser() routine, below. Returns: The Windows Tick Count at last keyboard or mouse event. ------------------------------------- ResetIdleOnUser C: int FAR PASCAL ResetIdleOnUser(int bReset); VB: Declare Function ResetIdleOnUser% Lib "HOWLONG.DLL" (ByVal bFlag%) Parameters: bReset - Integer Function: Allows the programmer to set or clear a flag used in the detection of WM_USER events for GetIdleTime(). If the value of the 'bReset' parameter is Zero, then WM_USER messages will be ignored by the GetIdleTime() routine. If the value of 'bReset' is non-zero, then any Windows Message that is greater than or equal to WM_USER will be sufficient to cause the GetIdleTime() routine to save the Tick Count. on Library initialization, WM_USER messages are seen. Calls to this routine do not cause the GetIdleTime() tick count to be reset. Returns: The previous value of the IdleOnUser flag.